/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package supermarketv1_class;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ΠΑΝΑΓΙΩΤΗΣ v1
 */
@Entity
@Table(name = "CREDIT_CARD_AUTHORITY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CreditCardAuthority.findAll", query = "SELECT c FROM CreditCardAuthority c"),
    @NamedQuery(name = "CreditCardAuthority.findByCcaId", query = "SELECT c FROM CreditCardAuthority c WHERE c.ccaId = :ccaId"),
    @NamedQuery(name = "CreditCardAuthority.findByCardnum", query = "SELECT c FROM CreditCardAuthority c WHERE c.cardnum = :cardnum"),
    @NamedQuery(name = "CreditCardAuthority.findByFullname", query = "SELECT c FROM CreditCardAuthority c WHERE c.fullname = :fullname"),
    @NamedQuery(name = "CreditCardAuthority.findByCvv", query = "SELECT c FROM CreditCardAuthority c WHERE c.cvv = :cvv")})
public class CreditCardAuthority implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CCA_ID")
    private Integer ccaId;
    @Column(name = "CARDNUM")
    private String cardnum;
    @Column(name = "FULLNAME")
    private String fullname;
    @Column(name = "CVV")
    private Integer cvv;
    @JoinColumn(name = "BANKCODE", referencedColumnName = "BANK_ID")
    @ManyToOne
    private Bank bankcode;

    public CreditCardAuthority() {
    }

    public CreditCardAuthority(Integer ccaId) {
        this.ccaId = ccaId;
    }

    public Integer getCcaId() {
        return ccaId;
    }

    public void setCcaId(Integer ccaId) {
        this.ccaId = ccaId;
    }

    public String getCardnum() {
        return cardnum;
    }

    public void setCardnum(String cardnum) {
        this.cardnum = cardnum;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public Integer getCvv() {
        return cvv;
    }

    public void setCvv(Integer cvv) {
        this.cvv = cvv;
    }

    public Bank getBankcode() {
        return bankcode;
    }

    public void setBankcode(Bank bankcode) {
        this.bankcode = bankcode;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ccaId != null ? ccaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CreditCardAuthority)) {
            return false;
        }
        CreditCardAuthority other = (CreditCardAuthority) object;
        if ((this.ccaId == null && other.ccaId != null) || (this.ccaId != null && !this.ccaId.equals(other.ccaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "supermarketv1_class.CreditCardAuthority[ ccaId=" + ccaId + " ]";
    }
    
}
